window.onload=function(){
	var b_s = document.getElementById("start");
		var b_p = document.getElementById("pause");
		var b_r = document.getElementById("reset");
		var d_d = document.getElementById("icar");
		var Accum_T = null;
		var ac_t = 521*1000;
		var inter = 0;
		var fps = 7;
		b_s.onclick = function(){
			fpsv = 1000/fps;
			if(Accum_T){clearInterval(Accum_T)};
			Accum_T = setInterval(function(){
				inter += fpsv;
				d_d.innerHTML = Math.floor(ac_t/(ac_t+inter)*10000)/100;
			},fpsv);
		};
		b_p.onclick = function(){
			clearInterval(Accum_T)
		};
		b_r.onclick = function(){
			clearInterval(Accum_T);
			d_d.innerHTML = "100";
			inter = 0;
			return inter;
		};
		
	var celltable=document.getElementById("tc");
	var cell=celltable.childNodes;
	var n = pomo();
	for (i=0;i<cell.length;i++){
		var currentCell = celltable.childNodes[i];
		if(currentCell.nodeName.toLowerCase()=="span" && i<n)
		{currentCell.getElementsByTagName("div")[0].style.background="#E6A"};
		if(currentCell.nodeName.toLowerCase()=="span" && i==n)
		{currentCell.getElementsByTagName("div")[0].style.background="#6AE"};
		currentCell.onclick=function(){
				this.getElementsByTagName("div")[0].style.border="1px solid red";				
		}
	}
}
function pomo(){
		var currentDate = new Date();
		c_time = currentDate.getHours()*60+currentDate.getMinutes();
		c_time = c_time*60 + currentDate.getSeconds();
		po_num = Math.floor(c_time/1600)
		c_time -= po_num*1600;
		po_mut = Math.floor(c_time/60);
		c_time -= po_mut*60;
		return po_num;
};